Optimal. Leaf size=130 \[ -4 a b \left (a^2-b^2\right ) x-\frac {\left (a^4-6 a^2 b^2+b^4\right ) \log (\cos (c+d x))}{d}+\frac {a b \left (a^2-3 b^2\right ) \tan (c+d x)}{d}+\frac {\left (a^2-b^2\right ) (a+b \tan (c+d x))^2}{2 d}+\frac {a (a+b \tan (c+d x))^3}{3 d}+\frac {(a+b \tan (c+d x))^4}{4 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.10, antiderivative size = 130, normalized size of antiderivative = 1.00, number of steps
used = 5, number of rules used = 3, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.158, Rules used = {3609, 3606,
3556} \begin {gather*} \frac {\left (a^2-b^2\right ) (a+b \tan (c+d x))^2}{2 d}+\frac {a b \left (a^2-3 b^2\right ) \tan (c+d x)}{d}-4 a b x \left (a^2-b^2\right )-\frac {\left (a^4-6 a^2 b^2+b^4\right ) \log (\cos (c+d x))}{d}+\frac {(a+b \tan (c+d x))^4}{4 d}+\frac {a (a+b \tan (c+d x))^3}{3 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3556
Rule 3606
Rule 3609
Rubi steps
\begin {align*} \int \tan (c+d x) (a+b \tan (c+d x))^4 \, dx &=\frac {(a+b \tan (c+d x))^4}{4 d}+\int (-b+a \tan (c+d x)) (a+b \tan (c+d x))^3 \, dx\\ &=\frac {a (a+b \tan (c+d x))^3}{3 d}+\frac {(a+b \tan (c+d x))^4}{4 d}+\int (a+b \tan (c+d x))^2 \left (-2 a b+\left (a^2-b^2\right ) \tan (c+d x)\right ) \, dx\\ &=\frac {\left (a^2-b^2\right ) (a+b \tan (c+d x))^2}{2 d}+\frac {a (a+b \tan (c+d x))^3}{3 d}+\frac {(a+b \tan (c+d x))^4}{4 d}+\int (a+b \tan (c+d x)) \left (-b \left (3 a^2-b^2\right )+a \left (a^2-3 b^2\right ) \tan (c+d x)\right ) \, dx\\ &=-4 a b \left (a^2-b^2\right ) x+\frac {a b \left (a^2-3 b^2\right ) \tan (c+d x)}{d}+\frac {\left (a^2-b^2\right ) (a+b \tan (c+d x))^2}{2 d}+\frac {a (a+b \tan (c+d x))^3}{3 d}+\frac {(a+b \tan (c+d x))^4}{4 d}+\left (a^4-6 a^2 b^2+b^4\right ) \int \tan (c+d x) \, dx\\ &=-4 a b \left (a^2-b^2\right ) x-\frac {\left (a^4-6 a^2 b^2+b^4\right ) \log (\cos (c+d x))}{d}+\frac {a b \left (a^2-3 b^2\right ) \tan (c+d x)}{d}+\frac {\left (a^2-b^2\right ) (a+b \tan (c+d x))^2}{2 d}+\frac {a (a+b \tan (c+d x))^3}{3 d}+\frac {(a+b \tan (c+d x))^4}{4 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 1.70, size = 123, normalized size = 0.95 \begin {gather*} \frac {6 \left ((a+i b)^4 \log (i-\tan (c+d x))+(a-i b)^4 \log (i+\tan (c+d x))\right )+48 a b \left (a^2-b^2\right ) \tan (c+d x)-6 b^2 \left (-6 a^2+b^2\right ) \tan ^2(c+d x)+16 a b^3 \tan ^3(c+d x)+3 b^4 \tan ^4(c+d x)}{12 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.04, size = 135, normalized size = 1.04
method | result | size |
norman | \(\left (-4 a^{3} b +4 a \,b^{3}\right ) x +\frac {b^{4} \left (\tan ^{4}\left (d x +c \right )\right )}{4 d}+\frac {4 a \,b^{3} \left (\tan ^{3}\left (d x +c \right )\right )}{3 d}+\frac {b^{2} \left (6 a^{2}-b^{2}\right ) \left (\tan ^{2}\left (d x +c \right )\right )}{2 d}+\frac {4 a b \left (a^{2}-b^{2}\right ) \tan \left (d x +c \right )}{d}+\frac {\left (a^{4}-6 a^{2} b^{2}+b^{4}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d}\) | \(130\) |
derivativedivides | \(\frac {\frac {b^{4} \left (\tan ^{4}\left (d x +c \right )\right )}{4}+\frac {4 a \,b^{3} \left (\tan ^{3}\left (d x +c \right )\right )}{3}+3 a^{2} b^{2} \left (\tan ^{2}\left (d x +c \right )\right )-\frac {b^{4} \left (\tan ^{2}\left (d x +c \right )\right )}{2}+4 a^{3} b \tan \left (d x +c \right )-4 a \,b^{3} \tan \left (d x +c \right )+\frac {\left (a^{4}-6 a^{2} b^{2}+b^{4}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (-4 a^{3} b +4 a \,b^{3}\right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) | \(135\) |
default | \(\frac {\frac {b^{4} \left (\tan ^{4}\left (d x +c \right )\right )}{4}+\frac {4 a \,b^{3} \left (\tan ^{3}\left (d x +c \right )\right )}{3}+3 a^{2} b^{2} \left (\tan ^{2}\left (d x +c \right )\right )-\frac {b^{4} \left (\tan ^{2}\left (d x +c \right )\right )}{2}+4 a^{3} b \tan \left (d x +c \right )-4 a \,b^{3} \tan \left (d x +c \right )+\frac {\left (a^{4}-6 a^{2} b^{2}+b^{4}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (-4 a^{3} b +4 a \,b^{3}\right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) | \(135\) |
risch | \(-4 a^{3} b x +4 a \,b^{3} x +i a^{4} x -6 i a^{2} b^{2} x +i b^{4} x +\frac {2 i a^{4} c}{d}-\frac {12 i a^{2} b^{2} c}{d}+\frac {2 i b^{4} c}{d}+\frac {4 i b \left (-9 i a^{2} b \,{\mathrm e}^{6 i \left (d x +c \right )}+3 i b^{3} {\mathrm e}^{6 i \left (d x +c \right )}+6 a^{3} {\mathrm e}^{6 i \left (d x +c \right )}-12 a \,b^{2} {\mathrm e}^{6 i \left (d x +c \right )}-18 i a^{2} b \,{\mathrm e}^{4 i \left (d x +c \right )}+3 i b^{3} {\mathrm e}^{4 i \left (d x +c \right )}+18 a^{3} {\mathrm e}^{4 i \left (d x +c \right )}-24 b^{2} a \,{\mathrm e}^{4 i \left (d x +c \right )}-9 i a^{2} b \,{\mathrm e}^{2 i \left (d x +c \right )}+3 i b^{3} {\mathrm e}^{2 i \left (d x +c \right )}+18 a^{3} {\mathrm e}^{2 i \left (d x +c \right )}-20 a \,b^{2} {\mathrm e}^{2 i \left (d x +c \right )}+6 a^{3}-8 b^{2} a \right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{4}}-\frac {a^{4} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{d}+\frac {6 \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) a^{2} b^{2}}{d}-\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) b^{4}}{d}\) | \(348\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.52, size = 124, normalized size = 0.95 \begin {gather*} \frac {3 \, b^{4} \tan \left (d x + c\right )^{4} + 16 \, a b^{3} \tan \left (d x + c\right )^{3} + 6 \, {\left (6 \, a^{2} b^{2} - b^{4}\right )} \tan \left (d x + c\right )^{2} - 48 \, {\left (a^{3} b - a b^{3}\right )} {\left (d x + c\right )} + 6 \, {\left (a^{4} - 6 \, a^{2} b^{2} + b^{4}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 48 \, {\left (a^{3} b - a b^{3}\right )} \tan \left (d x + c\right )}{12 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 1.31, size = 123, normalized size = 0.95 \begin {gather*} \frac {3 \, b^{4} \tan \left (d x + c\right )^{4} + 16 \, a b^{3} \tan \left (d x + c\right )^{3} - 48 \, {\left (a^{3} b - a b^{3}\right )} d x + 6 \, {\left (6 \, a^{2} b^{2} - b^{4}\right )} \tan \left (d x + c\right )^{2} - 6 \, {\left (a^{4} - 6 \, a^{2} b^{2} + b^{4}\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) + 48 \, {\left (a^{3} b - a b^{3}\right )} \tan \left (d x + c\right )}{12 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A]
time = 0.16, size = 187, normalized size = 1.44 \begin {gather*} \begin {cases} \frac {a^{4} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} - 4 a^{3} b x + \frac {4 a^{3} b \tan {\left (c + d x \right )}}{d} - \frac {3 a^{2} b^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{d} + \frac {3 a^{2} b^{2} \tan ^{2}{\left (c + d x \right )}}{d} + 4 a b^{3} x + \frac {4 a b^{3} \tan ^{3}{\left (c + d x \right )}}{3 d} - \frac {4 a b^{3} \tan {\left (c + d x \right )}}{d} + \frac {b^{4} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {b^{4} \tan ^{4}{\left (c + d x \right )}}{4 d} - \frac {b^{4} \tan ^{2}{\left (c + d x \right )}}{2 d} & \text {for}\: d \neq 0 \\x \left (a + b \tan {\left (c \right )}\right )^{4} \tan {\left (c \right )} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 1886 vs.
\(2 (124) = 248\).
time = 2.12, size = 1886, normalized size = 14.51 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 3.92, size = 168, normalized size = 1.29 \begin {gather*} \frac {\ln \left ({\mathrm {tan}\left (c+d\,x\right )}^2+1\right )\,\left (\frac {a^4}{2}-3\,a^2\,b^2+\frac {b^4}{2}\right )}{d}-\frac {{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (\frac {b^4}{2}-3\,a^2\,b^2\right )}{d}+\frac {b^4\,{\mathrm {tan}\left (c+d\,x\right )}^4}{4\,d}-\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (4\,a\,b^3-4\,a^3\,b\right )}{d}+\frac {4\,a\,b^3\,{\mathrm {tan}\left (c+d\,x\right )}^3}{3\,d}+\frac {4\,a\,b\,\mathrm {atan}\left (\frac {4\,a\,b\,\mathrm {tan}\left (c+d\,x\right )\,\left (a+b\right )\,\left (a-b\right )}{4\,a\,b^3-4\,a^3\,b}\right )\,\left (a+b\right )\,\left (a-b\right )}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________